﻿using Game.CheseBoard.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using cfg;
using Game.Command;
using QFramework;

namespace Game.CheseBoard.Data
{
    public class ProducerCell : BaseCell
    {
        public ProducerCell()
        {
        }

        public ProducerCell(int id) : base(id)
        {
        }

        cfg.Producer _producer;
        public cfg.Producer Producer
        {
            get
            {
                if (_producer == null)
                {
                    _producer = table.Tables.TbProducer.Get(piece.PieceId);
                }
                return _producer;
            }
        }
        //已放入的配方
        public readonly List<int> formula = new List<int>();
        //计时器ID
        public int producerTimerID = -1;
        //自动产出计时器ID
        public int autoProducerTimerID = -1;
        //储存产出的棋子
        public List<List<int>> producerPieces = new List<List<int>>();
        //可储存次数
        //public int producerStorageCount = 0;
        //生成次数
        public int producerMaxCount = 0;

        public int extraProducerCount = 0;
        public int ProducerCount
        {
            get
            {
                return extraProducerCount + Producer.ProducerCount;
            }
        }

        public override void SetPiece(int id)
        {
            base.SetPiece(id);
            _producer = table.Tables.TbProducer.Get(piece.PieceId);
            producerMaxCount = Producer.ProducerMaxCount;
        }
    }
}
